package main

import (
	"fmt"
	"sync"
	"time"
)

var wg1 sync.WaitGroup

func worker1(id int) {
	defer wg1.Done()
	fmt.Printf("worker %d starting work\n", id)
	time.Sleep(time.Second)
	fmt.Printf("worker %d end work\n", id)
	fmt.Println()
}

// func main() {
// 	size := 10
// 	wg1.Add(10)

// 	for i := 0; i < size; i++ {
// 		go worker1(i)
// 		time.Sleep(time.Second)
// 	}
// 	wg1.Wait()
// 	fmt.Println("main end~~~")
// }
